import {Directive} from "vue";
import {App} from 'vue'

class Initialization {
  directives: Map<string, Directive> = new Map<string, Directive>();

  init(app: App) {
    this.initDirectives(app);
  }

  initDirectives(app: App) {
    let keys = this.directives.keys();
    for (let key of keys) {
      app.directive(key, this.directives.get(key));
    }
  }

  registerDirective(name: string, directive: Directive) {
    if (this.directives.get(name)) {
      throw new Error("Directive 名称已经被使用:" + name);
    }
    this.directives.set(name, directive);
  }

}

let initialization = new Initialization();

import '/@/extend/directives/dragabble'
export default initialization;
